package com.relax;


import com.relax.aop.AopServiceImplA;
import com.relax.aop.AopServiceImplB;


import com.relax.aop.IAopServiceA;
import com.relax.aop.IAopServiceB;
import com.relax.config.MainConfig_aop;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class SpringApplicationDemo_aop {

    /**
     * aop 测试
     */
    @Test
    public void testAop() {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(MainConfig_aop.class);
//        AopServiceImplA aopServiceImplA = context.getBean(AopServiceImplA.class);//TODO 如果一个有接口的实现类被aop代理了,直接用这个service的实现类从spring中获取,会报错找不到

        IAopServiceA aopServiceA = context.getBean(IAopServiceA.class);
        aopServiceA.methodAop("彭青松");
//
//        IAopServiceB aopServiceB = context.getBean(IAopServiceB.class);
//        aopServiceB.methodAop();
    }


}
